import { defineStore } from 'pinia'

export const useStore = defineStore('store', {
  state: () => ({
    userInfo: JSON.parse(localStorage.getItem('userInfo') || '{}'),
  }),

  actions: {
    setUserInfo(userInfo = {}) {
      this.userInfo = userInfo
      localStorage.setItem('userInfo', JSON.stringify(userInfo))
    },
  },
})
